package com.jxpanda.spring.module.wechat.component.message.pojo.general;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.jxpanda.spring.module.wechat.component.message.pojo.MsgType;
import com.jxpanda.spring.module.wechat.component.message.pojo.WechatMessage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * 图文消息（mpnews）类
 */
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@Data
public class WechatMpNewsMessage extends WechatMessage {

    @JsonProperty("mpnews")
    private MpNews mpNews;

    @Override
    public String getMsgType() {
        return MsgType.MP_NEWS.getValue();
    }

    @Data
    public static class MpNews {
        @JsonProperty("articles")
        private List<Article> articles;

        @Data
        public static class Article {
            /**
             * 文章标题
             */
            @JsonProperty("title")
            private String title;

            /**
             * 文章缩略图媒体ID
             */
            @JsonProperty("thumb_media_id")
            private String thumbMediaId;

            /**
             * 文章作者
             */
            @JsonProperty("author")
            private String author;

            /**
             * 原文链接
             */
            @JsonProperty("content_source_url")
            private String contentSourceUrl;

            /**
             * 文章内容
             */
            @JsonProperty("content")
            private String content;

            /**
             * 文章摘要
             */
            @JsonProperty("digest")
            private String digest;
        }
    }
}

